﻿<!DOCTYPE html>
<!--制定整改计划-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <style>
        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }

        body {
            padding-bottom: 10px;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .el-form-item__content {
            line-height: 1.2 !important;
            margin-top: 6px;
        }

        .dian {
            display: inline-block;
            width: 5px;
            height: 5px;
            margin-left: 50px;
            background: #000;
            border-radius: 50%;
        }

        table {
            width: 100%;
            border-top: 0px solid;
            border-left: 0px solid;
        }

        table td,
        table th {
            border-right: 0px solid;
            border-bottom: 0px solid;
            border: 1px solid #dcdcdc;
            padding: 10px;
        }

        .main-label {
            width: 100%;
            text-align: left;
            float: left;
            font-size: 14px;
            color: #606266;
            line-height: 40px;
            box-sizing: border-box;
            margin: 0;
        }

        .popupW150 table .el-form-item__label {
            width: 100px !important;
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW150">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" size="mini" label-position="right">
            <el-row>
                <el-col class="head-tool">
                    <strong>隐患基础信息</strong>
                    <el-button class="fr" type="primary">{{col.btnPrint}}</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="15">
                    <el-form-item :label="RisksManagement.Rectification.RiskDescription+mark.m" class="inputTextarea">
                        {{Form.RiskDescription}}
                    </el-form-item>
                </el-col>
                <el-col :span="7" offset="2">
                    <el-link :underline="false" @click="OpenRiskDetails" type="primary"
                        style="font-size: 14px;color:#409eff;cursor:pointer;">
                        {{RisksManagement.RiskAcceptance.RiskDetails}}</el-link>
                </el-col>
            </el-row>
            <el-row>

                    <el-col :span="24">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <div class="el-input--mini el-input-group">
                                        <div class="el-input-group__prepend">
                                            {{RisksManagement.Rectification.RectificationCase+mark.m}}
                                        </div>
                                        <el-input class="el-textarea__inner" type="textarea" v-model="Form.RectificationCase"
                                            autocomplete="off"></el-input>
                                    </div>
                                </el-form-item>
                            </div>
                        </el-col>
            </el-row>

            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input type="text" v-model="Form.RectificationFund" autocomplete="off" size="mini">
                                    <template slot="prepend">
                                        {{RisksManagement.Rectification.RectificationFund+mark.m}}
                                    </template>
                                </el-input>
                            </el-form-item>

                        </div>
                    </el-col>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{RisksManagement.Rectification.SetRectificationLeading+mark.m}}
                                    </template>
                                    <treeselect v-model="Form.SetRectificationLeading"
                                        :options="SetRectificationLeading" :flat="true" :show-count="true"
                                        :disable-branch-nodes="true" slot="suffix"
                                        style="line-height:28px;width:60%;float: right;" placeholder="请选择" />
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.Rectification.Department+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.Department" slot="suffix"
                                        :placeholder="RisksManagement.Rectification.Department">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in Department" :label="item.label" :value="item.id">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">

                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{RisksManagement.Rectification.SetRectificationer+mark.m}}
                                    </template>
                                    <treeselect v-model="Form.SetRectificationer" :options="SetRectificationer"
                                        :flat="true" :show-count="true" :disable-branch-nodes="true" slot="suffix"
                                        style="line-height:28px;width:60%;float: right;" placeholder="请选择" />
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.Rectification.PlanTime+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.PlanTime" type="date" size="mini"
                                    placeholder="选择时间" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <!-- <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.Rectification.HaveContractor+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.HaveContractor" slot="suffix"
                                        :placeholder="RisksManagement.Rectification.HaveContingencyPlan"
                                        @change="ShowContractorMethod($event)">
                                        <el-option label="否" value="0"></el-option>
                                        <el-option label="是" value="1"></el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col> -->
                <!-- <el-col :span="11" offset="2" v-if="ShowContractor">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.Rectification.Contractor+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.Contractor" slot="suffix"
                                        :placeholder="RisksManagement.Rectification.Contractor">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in Contractors" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col> -->
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.Rectification.HaveContingencyPlan+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.HaveContingencyPlan" slot="suffix"
                                        :placeholder="RisksManagement.Rectification.HaveContingencyPlan"
                                        @change="ShowPlan($event)">
                                        <el-option label="否" value="0"></el-option>
                                        <el-option label="是" value="1"></el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row v-if="ShowEmergencyPlan">
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.EmergencyPlan+mark.m" prop="EmergencyPlan"
                        class="inputTextarea">
                        <el-input type="textarea" v-model="Form.EmergencyPlan" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>


                    <el-col :span="24">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <div class="el-input--mini el-input-group">
                                        <div class="el-input-group__prepend">
                                            {{RisksManagement.Rectification.CurrentPlan+mark.m}}
                                        </div>
                                        <el-input class="el-textarea__inner" type="textarea" v-model="Form.CurrentPlan"
                                            autocomplete="off"></el-input>
                                    </div>
                                </el-form-item>
                            </div>
                        </el-col>
            </el-row>
            <el-row>
                <el-col class="head-tool">
                    <strong>隐患流转记录</strong>
                </el-col>
            </el-row>
            <el-row>
                <table cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <tr>
                        <td>
                            <p class="main-label">{{RisksManagement.Rectification.ReportTime+mark.m}}<span
                                    class="dian"></span> </p>
                            <p class="lh35">{{Form.ReportTime}}</p>
                        </td>
                        <td>
                            <el-col :span="24">
                                <el-form-item :label="RisksManagement.Rectification.ReportDepartment+mark.m">
                                    {{Form.ReportDepartment}}
                                </el-form-item>
                            </el-col>
                            <el-col :span="24">
                                <el-form-item :label="RisksManagement.Rectification.ReportPersonnel+mark.m">
                                    {{Form.ReportPersonnel}}
                                </el-form-item>
                            </el-col>
                        </td>
                    </tr>
                </table>
            </el-row>
            <br>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="LevelUp('ruleForm')">{{col.btnLevelUpApply}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSubmit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog :title="RisksManagement.RiskAcceptance.RiskDetails" :visible.sync="ListItem.dialogVisible"
            width="80%" height="80%" top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script>
        //图片删除图标
        $(function () {
            $('body').on('mouseenter mouseleave', '.el-image', function (e) {
                if (e.type == 'mouseenter') {
                    $(this).prev("i").show();
                }
                else if (e.type == 'mouseleave') {
                    $(this).prev("i").hover(function () {
                        $(this).show()
                    }).hide()
                }
            })
        })
    </script>
    <script type="text/javascript">

        app = new Vue({
            el: '#app',
            data: {
                //父业传参
                id: '',
                Region: myTree,
                mydata: PersonInChargeTree,
                ShowEmergencyPlan: false,
                ShowContractor: false,
                ListItem: ListItem,
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    RiskDescription: '',
                    RectificationCase: '',
                    RectificationFund: '',
                    SetRectificationLeading: null,
                    Department: '',
                    SetRectificationer: null,
                    HaveContingencyPlan: '0',
                    HaveContractor: '0',
                    PlanTime: '',
                    CurrentPlan: '',
                    EmergencyPlan: '',
                },
                SetRectificationLeading: [],
                Department: [],
                SetRectificationer: [],
                HaveContingencyPlan: [],
                Contractors: [
                    { value: '承包商A', key: '1' },
                    { value: '承包商B', key: '2' }
                ],
                //表单验证
                rules: {

                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //隐患记录详细信息
                OpenRiskDetails: function () {
                    DialogShow(this, 'xg', "RiskRecordView.html", this.id);
                },
                ShowPlan: function (val) {
                    if (val === '1') {
                        this.ShowEmergencyPlan = true;
                    }
                    else {
                        this.ShowEmergencyPlan = false;
                        this.Form.EmergencyPlan = '';
                    }
                },
                ShowContractorMethod: function (val) {
                    console.log(val)
                    if (val === '1') {
                        this.ShowContractor = true;
                    }
                    else {
                        this.ShowContractor = false;
                        this.Form.Contractor = '';
                    }
                },
                //整改等级提升申请按钮事件
                LevelUp: function () {
                    showMessage("整改等级提升申请按钮事件", "success");
                },
                //提交数据
                onSubmitForm: function (formName) {
                    //如果应急预案选择否，则应急预案内容清空
                    if (this.Form.HaveContingencyPlan == '0') {
                        this.Form.EmergencyPlan = '';
                    }
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/Rectification/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });

                },
                getData: function () {

                    getData(this, '/api/Rectification/get?id=' + this.id);
                    this.RiskPosition = [];
                    this.RiskPosition = fn(this.mydata, this.Form.RegionName);
                },

            },
            mounted: function () {
                this.SetRectificationLeading = fn(this.mydata, "0");
                this.Department = fn(this.Region, "0");
                this.SetRectificationer = fn(this.mydata, "0");

                this.id = getUrlParam("id");
                this.getData();

                if (this.Form.HaveContingencyPlan == '1') {
                    this.ShowEmergencyPlan = true;
                }
                if (this.Form.HaveContractor == '1') {
                    this.ShowContractor = true;
                }
            }
        });
    </script>
</body>

</html>